package com.example.demo.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import org.springframework.data.annotation.Transient;

import java.io.Serializable;

/**
 * <p>
 * 
 * </p>
 *
 * @author yolo
 * @since 2025-03-20
 */


@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId("user_id")
    private Integer userId;

    private String username;

    private String password;

    private String role;

    @Transient
    //@Transient 可以防止序列化，当我们持久化的时候不会被持久化保存。
    @TableField(exist = false)
    private String token;


    public void filter(){
        this.setPassword(null);
    }
}
